public class Tank {
    private WeaponPlugin weapon;

    public void loadWeapon(WeaponPlugin weapon) {
        this.weapon = weapon;
    }

    public void attack() {
        if (weapon != null) {
            System.out.println("坦克使用" + weapon.getName());
            weapon.fire();
        }
    }

    public static void main(String[] args) {
        Tank tank = new Tank();
        try {
            WeaponPlugin cannon = PluginLoader.loadWeapon("F:/plugintest/plugintest/plugins/cannon-1.0-SNAPSHOT.jar", "CannonPlugin");
            tank.loadWeapon(cannon);
            tank.attack();
            WeaponPlugin machineGun = PluginLoader.loadWeapon("F:/plugintest/plugintest/plugins//machineGun-1.0-SNAPSHOT.jar", "MachineGunPlugin");
            tank.loadWeapon(machineGun);
            tank.attack();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
